package com.tanjun.mallservice.web.controller.cate;

import com.tanjun.common.model.R;
import com.tanjun.mallservice.apiservice.request.cate.CateTypeVo;
import com.tanjun.mallservice.apiservice.response.cate.CateTreeDto;
import com.tanjun.mallservice.web.biz.MallCateBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.tanjun.common.constants.UrlConstant.URL_AUTH.OPEN;

@RestController
public class CateController {
    private final String PREX = "/cate";
    @Autowired
    private MallCateBiz mallCateBiz;

    /**
     * 根据品类分组类型获取下面的所有分组
     * @param paramVo
     * @return
     */
    @PostMapping(OPEN + PREX + "/listTreeCateByCateType")
    public R<List<CateTreeDto>> listTreeCateByCateType(@RequestBody @Validated CateTypeVo paramVo) {
        return R.OK(mallCateBiz.listTreeCateByCateType(paramVo));
    }
}
